###########################
# Arms Market Events
###########################

#let's try to get all permission events into one?

add_namespace = armsmarket

#FROM desires permission to purchase british weapons!
country_event = {
	id = armsmarket.1
	title = armsmarket.1.t
	desc = armsmarket.1.desc
	picture = GFX_report_event_tur_cakmak_general_staff
	
	is_triggered_only = yes
	
	option = { # allow them to purchase from our companies
		name = armsmarket.1.a
        ai_chance = {
            factor = 25
            modifier = {
            	FROM = { has_non_aggression_pact_with = ROOT }
                factor = 30
            }
            modifier = {
            	FROM = { is_guaranteed_by = ROOT }
                factor = 30
            }
            modifier = {
            	FROM = { is_ally_with = ROOT }
                factor = 100
            }
            modifier = {
            	FROM = { is_puppet_of = ROOT }
                factor = 100 
            }
            modifier = {
            	FROM = { has_same_ideology = yes }
                factor = 15 
            }
            modifier = { #this is so random non-aligned countries have a better time buying from them.
            	OR = {
            		ROOT = { tag = BEL }
            		ROOT = { tag = CZE }
            	}
                factor = 15
            }
        }
		FROM = { 
			country_event = armsmarket.2
            add_relation_modifier = {
                target = FROM
                modifier = ROM_military_modernization
            }
		}
		#hidden_effect = {
			add_dynamic_modifier = { modifier = IAM_arms_exports_dynamic_modifier }
		#}
		IF = { 
			Limit = { tag = ENG }
			FROM = { set_country_flag = england_said_yes }
		}
		IF = { 
			Limit = { tag = FRA }
			FROM = { set_country_flag = french_said_yes }
		}
		IF = { 
			Limit = { tag = ITA }
			FROM = { set_country_flag = italy_said_yes }
		}
		IF = { 
			Limit = { tag = BEL }
			FROM = { set_country_flag = belgium_said_yes }
		}
		IF = { 
			Limit = { tag = GER }
			FROM = { set_country_flag = germany_said_yes }
		}
		IF = { 
			Limit = { tag = JAP }
			FROM = { set_country_flag = japanese_said_yes }
		}
		IF = { 
			Limit = { tag = SOV }
			FROM = { set_country_flag = soviet_said_yes }
		}
		IF = { 
			Limit = { tag = USA }
			FROM = { set_country_flag = america_said_yes }
		}
		IF = { 
			Limit = { tag = HOL }
			FROM = { set_country_flag = dutch_said_yes }
		}
		IF = { 
			Limit = { tag = YUG } #not currenly in use
			FROM = { set_country_flag = yugo_said_yes }
		}
		IF = { 
			Limit = { tag = POL }
			FROM = { set_country_flag = polish_said_yes }
		}
		IF = { 
			Limit = { tag = SWE }
			FROM = { set_country_flag = sweden_said_yes }
		}
		IF = { 
			Limit = { tag = CZE }
			FROM = { set_country_flag = czech_said_yes }
		}
		IF = { 
			Limit = { tag = HUN }
			FROM = { set_country_flag = hungary_said_yes }
		}
	}	

	option = { # nope!
		name = armsmarket.1.d
		ai_chance = {
			factor = 1
            modifier = {
            	FROM = { is_embargoing = ROOT }
                factor = 100
            }
            #modifier = {
            #	FROM = { is_embargoed_by = ROOT }
            #    factor = 100
            #}
            modifier = {
            	FROM = { is_enemy_ideology = yes }
                factor = 75
            }
            modifier = {
            	FROM = {
            		OR = {
						has_wargoal_against = ROOT
						is_justifying_wargoal_against = ROOT
					}
				}
                factor = 300
            }
            modifier = {
            	AND = {
            		FROM = { tag = POL }
            		ROOT = { tag = SOV}
            		ROOT = { has_government = communism }
            		POL = { NOT = { has_government = communism } }
            	}
                factor = 150
            }
            modifier = {
            	AND = {
            		FROM = { tag = FIN }
            		ROOT = { tag = SOV }
            		ROOT = { has_government = communism }
            		FIN = { NOT = { has_government = communism } }
            	}
                factor = 150
            }       
            modifier = {
            	OR = {
					has_opinion = {
					    target = FROM
					    value < -29
					}
					FROM = {
						has_opinion = {
						    target = ROOT
						    value < -29
						}
					}
				}
                factor = 75
			}
            modifier = {
                has_war = yes
                factor = 150
            }
		}
		FROM = { 
			country_event = armsmarket.3 
		}
		IF = { 
			Limit = { tag = ENG }
			FROM = { set_country_flag = england_said_no }
		}
		IF = { 
			Limit = { tag = ITA }
			FROM = { set_country_flag = italy_said_no }
		}
		IF = { 
			Limit = { tag = FRA }
			FROM = { set_country_flag = french_said_no }
		}
		IF = { 
			Limit = { tag = BEL }
			FROM = { set_country_flag = belgium_said_no }
		}
		IF = { 
			Limit = { tag = GER }
			FROM = { set_country_flag = germany_said_no }
		}
		IF = { 
			Limit = { tag = JAP }
			FROM = { set_country_flag = japanese_said_no }
		}
		IF = { 
			Limit = { tag = SOV }
			FROM = { set_country_flag = soviet_said_no }
		}
		IF = { 
			Limit = { tag = USA }
			FROM = { set_country_flag = america_said_no }
		}
		IF = { 
			Limit = { tag = HOL }
			FROM = { set_country_flag = dutch_said_no }
		}
		IF = { 
			Limit = { tag = YUG }
			FROM = { set_country_flag = yugo_said_no }
		}
		IF = { 
			Limit = { tag = POL }
			FROM = { set_country_flag = polish_said_no }
		}
		IF = { 
			Limit = { tag = SWE }
			FROM = { set_country_flag = sweden_said_no }
		}
		IF = { 
			Limit = { tag = CZE }
			FROM = { set_country_flag = czech_said_no }
		}
		IF = { 
			Limit = { tag = HUN }
			FROM = { set_country_flag = hungary_said_no }
		}
	}	
}

country_event = { #Britian allows companies to export to ROOT!
	id = armsmarket.2
	title = armsmarket.2.t
	desc = armsmarket.2.desc
	picture = GFX_report_event_tur_cakmak_general_staff
	
	is_triggered_only = yes
	
	option = { # Neat!
		name = armsmarket.2.a
            add_relation_modifier = {
                target = FROM
                modifier = ROM_military_modernization
            }
		ai_chance = {
			factor = 100
		}
	}	
}

country_event = { #Britian says no to any arms exports
	id = armsmarket.3
	title = armsmarket.3.t
	desc = armsmarket.3.desc
	picture = GFX_report_event_tur_cakmak_general_staff
	
	is_triggered_only = yes
	
	option = { # Shame. 
		name = armsmarket.3.a
		ai_chance = {
			factor = 100
		}
	}	
}
